#ifndef __STDTCPSERVICE_H__
#define __STDTCPSERVICE_H__
#include <stdio.h>
#include <iostream>
#include <string>
/*通信类*/
class StdTcpSocket
{
public:
    /*连接服务器*/
   bool connectToServer(const char* ip, int port);
   /*发送数据*/
   int sendMessage(const void *sendMsg,size_t size);
   /*发送数据*/
   int sendMessage(const std::string& sendMsg);
   /*接收数据*/
   int recvMessage(void *buf,size_t size);
   /*接收数据*/
   int recvMessage(std::string& recvMeaasge);
   /*设置通信句柄*/
   void setConnfdAttr(int connfd);

private:
    int m_connfd;
};
/*服务器类*/
class StdTcpServer
{
public:
    /*设置监听*/
    void setListen(int port);
    /*得到与客户端的通信句柄（类)*/
    StdTcpSocket * getClientSock();
private:
    /*端口*/
    int m_port;
    int m_sockfd;
};

#endif